<?php 

/**
 *	服务器变量：$_SERVER
 *	环境变量：  $_PATH
 *	
 */

	function getip(){
		if(!empty($_SERVER['HTTP_VIA'])){
			return $_SERVER['HTTP_VIA'];
		}else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
			return $_SERVER['HTTP_X_FORWARDED_FOR'];
		}else if(!empty($_SERVER['REMOTE_ADDR'])){
			return $_SERVER['REMOTE_ADDR'];
		}else{
			return "无法获取ip";
		}
	}

	$result = getip();
	echo $result;

	echo "<hr>";

	echo count($_SERVER);

	echo "<pre>";
		print_r($_SERVER);
	echo "</pre>";




 ?>